- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
Replace webhook implementation with WebhookManagedBy. #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace webhook implementation with WebhookManagedBy. #27
Conversation
…By." This reverts commit 8211c57.
Updates the hncconfig validator to use the modern WebhookManagedBy pattern instead of manual webhook registration, following the same approach used for HierarchyConfiguration. Changes: - Add NewValidator constructor function - Replace Handle method with ValidateCreate/Update/Delete methods - Convert internal validation logic to return errors instead of admission responses - Update webhook registration in setup/webhooks.go to use WebhookManagedBy - Update tests to use new API and remove unused logResult function 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Updates the anchor (SubnamespaceAnchor) validator to use the modern WebhookManagedBy pattern instead of manual webhook registration. Changes: - Add NewValidator constructor function - Replace Handle method with ValidateCreate/Update/Delete methods - Convert internal validation logic to return errors instead of admission responses - Update webhook registration in setup/webhooks.go to use WebhookManagedBy - Update tests to use new handleValidation method and remove unused logResult function 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Updates the namespace validator to use the modern WebhookManagedBy pattern instead of manual webhook registration. Changes: - Add NewValidator constructor function - Replace Handle method with ValidateCreate/Update/Delete methods - Convert internal validation logic to return errors instead of admission responses - Update all validation methods to return errors - Update webhook registration in setup/webhooks.go to use WebhookManagedBy - Update tests to use new handleValidation method and remove unused logResult function 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Updates the namespace mutator to use the modern WebhookManagedBy pattern instead of manual webhook registration. Changes: - Add NewMutator constructor function - Replace Handle method with Default method for the defaulter interface - Rename internal handle method to mutateNamespace - Update webhook registration in setup/webhooks.go to use WebhookManagedBy with WithDefaulter - Update tests to use new mutateNamespace method - Remove unused imports and InjectDecoder method 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Convert ResourceQuotaStatus to use ValidateCreate/Update/Delete methods instead of Handle - Add NewResourceQuotaStatus constructor with client and forest parameters - Update validateResourceQuotaStatus to return errors instead of admission responses - Add helper functions for admission responses (allow, deny, denyInvalidField, codeFromReason) - Update tests to use validateHRQResourceQuotaStatus method directly - Remove old injection methods (InjectClient, InjectDecoder) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Convert HRQ to use ValidateCreate/Update/Delete methods instead of Handle - Add NewHRQ constructor with client parameter for dry-run client setup - Update validate method to return errors instead of admission responses - Convert validation to use apierrors.NewInvalid with field validation - Update tests to use validate method directly with error checking - Remove old injection methods (InjectClient, InjectDecoder) - Add missing imports for field validation and runtime types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…a and HierarchicalResourceQuota. - Replace manual webhook registration with builder.WebhookManagedBy() pattern - Use NewResourceQuotaStatus constructor for ResourceQuota webhook - Use NewHRQ constructor for HierarchicalResourceQuota webhook - Add proper error handling for webhook creation - Remove old manual injection and registration code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…ok creation accordingly
| Confirmed the validator for HierarchyConfiguration works:  | 
…ects in createWebhooks function
| } | ||
|  | ||
| // Create webhooks for managed objects | ||
| // Note: We cannot use WebhookManagedBy here because objects validator handles all resource types dynamically (*) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use WebhookManagedBy here because getType(), which is called by registerWebhooks, returns an error when the type is not set.
https://github.com/kubernetes-sigs/controller-runtime/blob/v0.20.4/pkg/builder/webhook.go#L263-L268
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold for @superbrothers's review
Thanks. AFAI, the existing core logic remains unchanged, but the details have been modified to support WebhookManagedBy, such as returning err.
Replace objects validator too.fixes #20